<!-- list -->
<ul class="nav" ng-controller="navCtrl">
	<li>
	    <a href="javascript:;" ui-sref="app.home.index" class="auto">
	        <span class="pull-right text-muted">
	            <i class="fa fa-fw fa-angle-down text-active"></i>
	        </span>
	        <i class="glyphicon glyphicon-home"></i>
	        <span class="font-bold">首页概览</span>
	    </a>
    </li>
    <li ng-repeat="module in modules.result" repeat-finish="renderFinish()">
	    <a href="javascript:;" class="auto">
	        <span class="pull-right text-muted">
	            <i class="fa fa-fw fa-angle-right text"></i>
	            <i class="fa fa-fw fa-angle-down text-active"></i>
	        </span>
	        <i class="{{module.menuVo.menuIconCss}}"></i>
	        <span class="font-bold">{{module.menuVo.menuName}}</span>
	    </a>
	    <ul class="nav nav-sub dk">
	        <li class="nav-sub-header">
	            <a href="javascript:;">
	            	<span>后台管理</span>
	            </a>
	        </li>
	        <li class="navItem" ui-sref-active="active" ng-repeat="menu in module.childList" data-id="{{menu.menuVo.id}}">
		        <a ui-sref="{{menu.menuVo.menuPath}}">
		            <span>{{menu.menuVo.menuName}}</span>
		        </a>
	        </li>
	    </ul>
    </li>
</ul>
<!-- / list -->

<script>
	
	app.controller("navCtrl",function($scope,rest,$localStorage,$window,user){
		$(document).find(".navItem.active").css("background-color",'#F96F39');
		$(document).find(".nav>li.active").css("background-color",'#F96F39');
		var userId = $window.localStorage.getItem("id");
		var token = $window.localStorage.getItem("token");
		//console.log(userId,token)
		
		rest.decoJava({
			type: 'post',
            url: "/tenancy-sys/admin/user/accessTree",
            data: {userId:userId},
            beforeSend: function(request){
				request.setRequestHeader("token", token); 
			},
            success: function(data){
            	$scope.$apply(function(){
            		$scope.modules = data;
            	})
            }
        })
		
		//ng-repeat渲染完之后的操作
		$scope.renderFinish = function(){
		    //发送延迟响应
			user.response('true');
		}
		
	})
	
</script>